package Json;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description
 * @Author zhongzihao
 * @Date 2021/8/4 10:02 上午
 */
public class Test {
    public static void main(String[] args) {
//        test1();
//        test2();
//        test03();
        test04();
    }

    public static byte[] test1() {
        List<Book> books = new ArrayList<>();
        books.add(new Book("a", 1.0));
        books.add(new Book("b", 2.0));
        Student student = new Student(
                books, new Teacher("zzz", 23)
        );
        return JSON.toJSONString(student).getBytes();
    }
    public static void test2(){
//       String s = test1().toString();
       String s = new String(test1());
        JsonToPojo jsonToPojo = new JsonToPojo();
        Student student = jsonToPojo.getObject(s,Student.class);
        System.err.println(student);
    }


    public  static void test03(){
        List<String> list = new ArrayList<>();
        list.add("sadasdasdasdasd");
        list.add("xxxxxxxx");
        JsonToList jsonToList = new JsonToList();
        System.err.println(jsonToList.listToJson(list));
    }

    public static void test04(){
        List<Book> list = null;
        List<String> l=list.stream().map(
            Book::getBookName
        ).collect(Collectors.toList());
    }


}
